home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / GCC 1.37.1r14 / usr / gcc-1.37.1r14 / object oriented files / CPathArray.cp < prev    next >
Encoding:
Text File  |  1993-10-04  |  1.0 KB  |  54 lines  |  [TEXT/KAHL]

  1.  "CPathArray.h"
  2.  
  3. void CPathArray::IPathArray( void )
  4. {
  5.     CArray::IArray( sizeof( FSSpec));
  6.     
  7. }    /* CPathArray::IPathArray */
  8.  
  9.  
  10. void CPathArray::IRes( short strListID)
  11.     {
  12.     Handle    strList;
  13.     Str255    str;
  14.     short    i, numStrings;
  15.     
  16.     IArray( sizeof( FSSpec) );
  17.     
  18.     strList = GetResource( 'PREF', strListID);
  19.     if (strList)
  20.         {
  21.         numStrings = GetHandleSize(strList)/sizeof( FSSpec );
  22.         Resize( numStrings);
  23.     
  24.         for (i = 1; i <= numStrings; i++)
  25.             {
  26.             OSErr iErr;
  27.             FSSpec    spec;
  28.             BlockMove((i-1)*sizeof( FSSpec )+*strList, &spec, sizeof( FSSpec ));
  29.             InsertAtIndex( &spec, i);
  30.             }
  31.         }
  32.     else
  33.         {
  34.         /* ensure the STR# resource exists    */
  35.     
  36.         strList = GetResource( 'STR#', strListID);
  37.         FailNILRes( strList);
  38.         /* resize once to accomodate all the strings    */
  39.     
  40.         numStrings = *(short*) *strList;
  41.         Resize( numStrings);
  42.     
  43.         for (i = 1; i <= numStrings; i++)
  44.             {
  45.             OSErr iErr;
  46.             FSSpec    spec;
  47.             GetIndString( str, strListID, i);
  48.             iErr = FSMakeFSSpec(0,0,str,&spec);
  49.             if (( iErr==fnfErr ) || !iErr)
  50.                 InsertAtIndex( &spec, i);
  51.             }
  52.         }
  53.     }
  54. .*QÒn Ö